home *** CD-ROM | disk | FTP | other *** search
/ Otherware / Otherware_1_SB_Development.iso / mac / hypercar / fun / recipe2.cpt / Recipe 2.0b / stack_-1.xml < prev    next >
Encoding:
Extensible Markup Language  |  1992-07-13  |  31.9 KB  |  79 lines

  1. <?xml version="1.0" encoding="utf-8" ?>
  2. <!DOCTYPE stack PUBLIC "-//Apple, Inc.//DTD stack V 2.0//EN" "" >
  3. <stack>
  4.     <name>in.0b</name>
  5.     <id>-1</id>
  6.     <cardCount>52</cardCount>
  7.     <cardID>4448</cardID>
  8.     <listID>5703</listID>
  9.     <cantModify><false /></cantModify>
  10.     <cantDelete><false /></cantDelete>
  11.     <cantAbort><false /></cantAbort>
  12.     <cardSize>
  13.         <width>512</width>
  14.         <height>302</height>
  15.     </cardSize>
  16.     <script>on openStack
  17. ---
  18. --set up Goodies menubar
  19. ---
  20. set rectangle of this card to 0,0,512,302 --for small screens
  21. set cursor to busy
  22. create menu "Goodies"
  23. put "Index" into menu "Goodies" with menuMsg "doIndex"
  24. set commandChar of menuItem "Index" of menu "Goodies" to "I"
  25.  
  26. put "Conversion" after menu "Goodies" with menuMsg "go card Conversion"
  27. set commandChar of menuItem "Conversion" of menu "Goodies" to "T"
  28.  
  29. put "Browse" after menu "Goodies" with menuMsg "go card Browse"
  30. set commandChar of menuItem "Browse" of menu "Goodies" to "B"
  31.  
  32. --  put "Move Card" after menu "Goodies" with menuMsg "MoveCard"
  33. put "Info" after menu "Goodies" with menuMsg "OpenInfoBox"
  34. put "Merge Recipes" after menu "Goodies" with menuMsg "MergeStacks"
  35.  
  36. if the optionKey is down then
  37. put "UserLevel 5" after menu "Goodies" with menuMsg "set userlevel to 5"
  38. set commandChar of menuItem "UserLevel 5" of menu "Goodies" to "0"
  39. end if
  40.  
  41. ---
  42. --- set up fractions menubar
  43. ---
  44. create menu "Fractions"
  45. set cursor to busy
  46. put "1/4,1/2,3/4,1/3,2/3,┬░,Γëê" into menu "Fractions"
  47. set menuMsg of menuItem "1/4" of menu "Fractions" to "doQrt"
  48. set commandChar of menuItem "1/4" of menu "Fractions" to "1"
  49. set menuMsg of menuItem "1/2" of menu "Fractions" to "doHalf"
  50. set commandChar of menuItem "1/2" of menu "Fractions" to "2"
  51. set cursor to busy
  52. set menuMsg of menuItem "3/4" of menu "Fractions" to "doTF"
  53. set commandChar of menuItem "3/4" of menu "Fractions" to "3"
  54. set menuMsg of menuItem "1/3" of menu "Fractions" to "doTrd"
  55. set commandChar of menuItem "1/3" of menu "Fractions" to "4"
  56. set menuMsg of menuItem "2/3" of menu "Fractions" to "doTTrd"
  57. set commandChar of menuItem "2/3" of menu "Fractions" to "5"
  58. set menuMsg of menuItem "┬░" of menu "Fractions" to "dodeg"
  59. set commandChar of menuItem "┬░" of menu "Fractions" to "6"
  60. set menuMsg of menuItem "Γëê" of menu "Fractions" to "doaprox"
  61. set commandChar of menuItem "Γëê" of menu "Fractions" to "7"
  62.  
  63.  
  64. if visible of cd fld InfoBox of card index then push card index
  65. set userlevel to 2
  66. end openStack
  67.  
  68. on closeStack
  69. --  answer "Do you want to compact the stack" with "Yes" or "No"
  70. --  if it is "Yes" then
  71. --    domenu "compact stack"
  72. --  end if
  73.  
  74. reset menubar
  75. if there is a window "navigator" then send "close" to window "navigator"
  76. end closeStack
  77.  
  78. on resumeStack
  79. openStack
  80. end resumeStack
  81.  
  82. on doIndex
  83. visual effect scroll down fast
  84. go card "Index"
  85. end doIndex
  86.  
  87. on suspendStack
  88. closeStack
  89. end suspendStack
  90.  
  91. ---
  92. --Fraction menu Output
  93. ---
  94. on doQrt
  95. if selectedLine() is not empty then put "1/4" after selection
  96. end doQrt
  97.  
  98.  
  99. on doHalf
  100. if selectedLine() is not empty then put "1/2" after selection
  101. end doHalf
  102.  
  103. on doTF
  104. if selectedLine() is not empty then put "3/4" after selection
  105. end doTF
  106.  
  107. on doTrd
  108. if selectedLine() is not empty then put "1/3" after selection
  109. end doTrd
  110.  
  111. on doTTrd
  112. if selectedLine() is not empty then put "2/3" after selection
  113. end doTTrd
  114.  
  115. on dodeg
  116. if selectedLine() is not empty then put "┬░" after selection
  117. end dodeg
  118.  
  119. on doaprox
  120. if selectedLine() is not empty then put "Γëê" after selection
  121. end doaprox
  122.  
  123.  
  124.  
  125. on doMenu MenuItem
  126. if MenuItem is "Delete Card" then
  127. if the optionkey is down then
  128. answer "DELETE ENTIRE COLLECTION OF RECIPES!!" with "DELETE", "no"
  129. if it is "DELETE" then
  130. do makeVirgin
  131. end if
  132. else
  133. answer "Are you sure you want to delete?" with "No" or "Yes"
  134. if it = "Yes" then
  135. if cantDelete of this card is true then
  136. if the name of the next card is not the name of this card then
  137. do RemoveNameFromMenu
  138. doClearCard
  139. else
  140. set cantDelete of this card to false -- deletes a place holder card
  141. set cantDelete of the next card to true -- only if the next card can substitute as a place holder
  142. if bkgnd fld "Recipe" is not empty then --if title is already gone, no poptab update on close card
  143. put empty into bkgnd fld Recipe
  144. do RemoveNameFromMenu
  145. end if
  146. set cantDelete of this card to false -- deletes a place holder card
  147. set cantDelete of the next card to true -- only if the next card can substitute as a place holder
  148. put the short name of this card into cardName
  149. if length of cardName < 8 then
  150. put char 7 of cardName into BaseNumber
  151. else
  152. put char 7 to 8 of cardName into BaseNumber
  153. end if
  154. put the id of the next card into line BaseNumber of cd fld IDsOfRecipe of cd conversion--make new place holder
  155. pass doMenu
  156. end if
  157. else
  158. hide cd btn "Update Index" of Card "Index"
  159. if bkgnd fld "Recipe" is not empty then
  160. put empty into bkgnd fld Recipe --when title is gone, no poptab update on close card
  161. do RemoveNameFromMenu
  162. pass doMenu
  163. else pass doMenu
  164. end if
  165. end if
  166. end if
  167.  
  168. else if MenuItem is "New Card" then doNewCard
  169. else if MenuItem is "Find..." and not the visible of cd btn "cmd-F now Finds" of cd Browse then
  170. do Browse
  171.  
  172. else if MenuItem is "Print Card" then
  173. if id of this card = id of card index then
  174. answer "Print recipe titles or recipes listed in this index?" with cancel,titles, recipes
  175. if it is "titles" then
  176. if cd fld indexList is empty then
  177. answer "Index is empty, nothing will be printed." with okay
  178. else
  179. print cd fld indexlist
  180. end if
  181. else if it is "recipes" then
  182. do PrintIndex
  183. end if
  184. else if char 7 to 12 of name of this card is "recipe" then
  185. if bkgnd fld Recipe is not empty then
  186. open report printing
  187. print this card
  188. close printing
  189. else answer "There is no title to this recipe." with "Halt Printing"
  190. else
  191. answer "Sorry, you can't print this card." with okay
  192. end if
  193. else
  194. pass doMenu
  195. end if
  196. end domenu
  197.  
  198.  
  199.  
  200. on doClearCard
  201. if short name of this card is not "Index" and the short name of this card is not "Conversion" then
  202. put empty into bkgnd field "Recipe"
  203. put "Ingredients:" & RETURN into bkgnd field "Ingrediants"
  204. put "Directions:" & RETURN into bkgnd field "Directions"
  205. put empty into bkgnd field "Nationality"
  206. put empty into bkgnd field "PrepTime"
  207. put empty into bkgnd field "Serves"
  208. put "Source:" & RETURN into bkgnd field "Reference"
  209. put "1" into bkgnd field "Difficulty"
  210. put "?" into bkgnd field "Freezes"
  211. put "?" into bkgnd field "Refrig"
  212. set the hilite of bkgnd button "Lacto" to false
  213. set the hilite of bkgnd button "Tried" to false
  214. set the hilite of bkgnd button "Ovo" to false
  215. set the hilite of bkgnd button "MeatType" to false
  216. set the hilite of bkgnd button "FishType" to false
  217. set the hilite of bkgnd button "VegetarianType" to false
  218. if not visible of bkgnd fld Directions then
  219. click at (location of bkgnd btn "Etc.")
  220. end if
  221. hide cd btn "Update Index" of Card "Index"
  222. else
  223. answer "You can not alter this card" with "OK"
  224. end if
  225. end doClearCard
  226.  
  227. ---
  228. ---New recipe card routine
  229. ---
  230. on doNewCard
  231. if the number of cd Recipe1 <= the number of this card then
  232. answer "Add card here?" with Cancel or No or Yes
  233.  
  234. if it is yes then
  235. do AddCard
  236.  
  237. else if it = "no" then
  238. lock screen
  239. go card "Index"
  240. show cd fld Background
  241. show cd button "Cancel"
  242. show cd btn "Click and Hold"
  243. unlock screen
  244. end if
  245.  
  246. else
  247. lock screen
  248. go card "Index"
  249. show cd fld Background
  250. show cd btn "Click and Hold"
  251. show cd btn cancel
  252. unlock screen
  253. end if
  254. end doNewCard
  255.  
  256. on AddCard
  257. set userlevel to 3
  258. doMenu "Copy Card"
  259. doMenu "Paste Card"
  260. doClearCard
  261. set cantDelete of this card to false
  262. set userlevel to 2
  263. NewRecipeInMenu
  264. select text of bkgnd field "Recipe"
  265. hide cd btn "Update Index" of Card "Index"
  266. end AddCard
  267.  
  268. on OpenInfoBox
  269. push card
  270. go card Index
  271. if the OptionKey is down then show cd fld VersionInfo
  272. else show cd fld InfoBox
  273. end OpenInfoBox
  274.  
  275. On CloseInfoBox
  276. hide cd fld InfoBox
  277. hide cd fld VersionInfo
  278. pop card
  279. end CloseInfoBox
  280.  
  281.  
  282. ---This procedure merges another recipe stack with currently open stack
  283. on MergeStacks
  284.  
  285. answer "Automatic of Manual merge?" with "Automatic", "Manual", "Cancel"
  286. if it is "Cancel" then exit MergeStacks
  287. put it into howMerging
  288. if howMerging is "Automatic" then
  289. answer "Copy the tab headings from the old stack" with "Yes", "No"
  290. if it is "Yes" then put true into moveTabs
  291. else put false into moveTabs
  292. end if
  293.  
  294.  
  295. ---ask for the stack to be merged with this one
  296. answer file "Open other recipe stack" of type STAK
  297. if it is empty then exit MergeStacks
  298.  
  299. put "Stack "&quote&it&quote into OldStackName
  300. put the long name of this stack into NewStackName
  301.  
  302. --test if old stack is a recipe stack
  303. go OldStackName in a new window
  304. if there is no card "Recipe1" then
  305. answer "This is not a valid Recipe stack" with okay
  306. exit MergeStacks
  307. end if
  308.  
  309. if howMerging ="Manual" then
  310. --Manual Merge; sets up list of recipes and goes to conversion card to process
  311. --generate a list of recipes and their associated tab locations
  312. go newStackName
  313. put GenerateHeaderList() into newheaderList--for comparison purposes
  314. go oldStackName
  315. put RecipeList(newHeaderList) into it
  316. go newStackName
  317. put it into cd fld oldStackRecipes of cd conversion
  318. go newStackName
  319. show cd fld "oldStackRecipes" of cd conversion
  320. show cd fld "instructions" of cd conversion
  321. show cd btn "process" of cd conversion
  322. show cd btn "Cancel" of cd conversion
  323. disable menuItem "Conversion" of menu "goodies"
  324. put "Merge Window" into menuItem "Merge Recipes" of menu "Goodies" with menuMsg "go card Conversion"
  325. go cd conversion
  326. put oldStackName &return&newStackName into cd fld StackNames
  327. else
  328. --Automaticaly insert recipes into stack
  329. --assumes stacks exist and are recipe stacks and I'm in the old recipe stack
  330. lock screen
  331. set cursor to busy
  332. ProgressWindow "┬⌐Dome","Merging","Now adding cards to stack."
  333. put the number of the last card into totalCards
  334. repeat with i = the number of card Recipe1 to the number of the last card
  335. set "thePercent" of window "Merging" to (i/totalCards*100)
  336. go card i of oldStackName
  337. if bkgnd fld recipe is not empty then
  338. CopyCard (id of this card &" of "& oldStackName),(name of this card &" of "& newStackName)
  339. end if
  340. end repeat
  341. if moveTabs then
  342. --move the tab headings from the old stack to the new stack
  343. go oldStackName
  344. put empty into tabHeadings
  345. repeat with i = 1 to 7
  346. put BadCharReplace(bkgnd fld ("i"&i) of cd "Index") &"," after tabHeadings
  347. repeat with j= 1 to 7
  348. put BadCharReplace(bkgnd fld ("M"&i&"S"&j) of cd (Recipe&(i*7))) & "," after tabHeadings
  349. end repeat
  350. put return after tabHeadings
  351. end repeat
  352. go newStackName
  353. put (line 1 of cd fld MainAndSub of cd conversion) & return & tabHeadings into cd fld MainAndSub of cd conversion
  354. repeat with i = 1 to 7
  355. put item 1 of line i of tabHeadings into bkgnd fld ("i"&i) of cd "Index"
  356. repeat with j=1 to 7
  357. put item j+1 of line i of tabHeadings into bkgnd fld ("M"&i&"S"&j) of cd (Recipe&(i*7))
  358. end repeat
  359. end repeat
  360. end if
  361. --tidy things up, close old stack
  362. go oldStackName in a new window
  363. domenu "Close Stack"
  364. go cd index of newStackName
  365. close window "Merging"
  366. play "sosumi" "a3s b c4 a3 a3h"
  367. answer "Merging completed" with okay
  368. unlock screen
  369. end if
  370. end MergeStacks
  371.  
  372. function GenerateHeaderList
  373. --make list of associated tabs (main,sub), assumes i'm in proper stack
  374. ProgressWindow "┬⌐Dome","TabHeadings",("Compiling tab for "&the short name of this stack)
  375. put "" into recipeId
  376. repeat with j = 1 to 7 --generate tab name list
  377. repeat with i = 1 to 7
  378. set "thePercent" of window "TabHeadings" to ((j*7+i)/49*100)
  379. put (bkgnd fld ("i"&j) of cd index) & "," & (bkgnd fld ("M"&j&"S"&i) of cd ("Recipe" & (j*7))) & return after recipeId
  380. end repeat
  381. end repeat
  382. close window "TabHeadings"
  383. return recipeId
  384. end GenerateHeaderList
  385.  
  386.  
  387. function RecipeList newHeaderList
  388. --assumes i'm in a stack where i'm to compare recipes with the headerlist i've been provided
  389.  
  390. put GenerateHeaderList () into oldHeaderList
  391.  
  392. go cd recipe1
  393. ProgressWindow "┬⌐Dome","RecipeList",("Recipe list for  "&the short name of this stack)
  394. put "" into theList
  395. put the number of the last card into totalCards
  396. repeat with i = the number of this card to the number of the last card
  397. set "thePercent" of window "RecipeList" to i/totalCards*100
  398. if bkgnd fld recipe of cd i is not empty then
  399. put the short name of card i into cardName
  400. if the length of cardName < 8 then
  401. put char 7 of cardName into recipeNumber
  402. else
  403. put char 7 to 8 of cardName into recipeNumber
  404. end if
  405.  
  406. if line recipeNumber of oldHeaderList <> line recipeNumber of newHeaderList then
  407. put "*" into warning
  408. else put " " into warning
  409.  
  410. put warning&(line recipeNumber of oldHeaderList)&","&(bkgnd fld Recipe of cd i)&","&cardName&","&(the short id of cd i)&return after theList
  411. end if
  412. end repeat
  413. close window "RecipeList"
  414. return theList
  415. end recipeList
  416.  
  417. on CopyCard oldCard, newCard
  418.  
  419. ---assumes input of long name of old and new card and they exist.  Goes to old card to copy data┬¼
  420. ---then goes to new card site and inserts new card. Remains at new card location.
  421. go oldCard
  422. put char 1 to 35 of bkgnd fld "Recipe" into Recipe
  423. put bkgnd fld "Ingrediants" into Ingrediants
  424. put bkgnd fld "Directions" into Directions
  425. put bkgnd fld "PrepTime" into PrepTime
  426. put bkgnd fld "Nationality" into Nationality
  427. put bkgnd fld "Difficulty" into Difficulty
  428. put bkgnd fld "Freezes" into Freezes
  429. put bkgnd fld "Refrig" into refrig
  430. put bkgnd fld "Serves" into serves
  431. put bkgnd fld "reference" into  reference
  432. put hilite of bkgnd btn "lacto" into lacto
  433. put hilite of bkgnd btn "ovo" into ovo
  434. put hilite of bkgnd btn "meattype" into meattype
  435. put hilite of bkgnd btn "fishtype" into fishtype
  436. if there is a bkgnd btn tried then
  437. put hilite of bkgnd btn "tried" into tried
  438. else
  439. put false into tried
  440. end if
  441.  
  442. ---Now switch to the stack where it will be merged with
  443. go newCard
  444.  
  445. put false into errorCard
  446. if the long name of this card is not newCard then
  447. beep
  448. answer "Can not find where to put this card.  Skipping it." with okay
  449. put true into errorCard
  450. else
  451. ---see if card blank, if not, make a new one
  452. if bkgnd fld "Recipe" is not empty then do AddCard
  453. put Recipe into bkgnd fld "Recipe"
  454. put Ingrediants into bkgnd fld "Ingrediants"
  455. put Directions into bkgnd fld "Directions"
  456. put PrepTime into bkgnd fld "PrepTime"
  457. put Nationality into bkgnd fld "Nationality"
  458. put Difficulty into bkgnd fld "Difficulty"
  459. put Freezes into bkgnd fld "Freezes"
  460. put Refrig into bkgnd fld "refrig"
  461. put Serves into bkgnd fld "serves"
  462. put Reference into bkgnd fld "reference"
  463. set hilite of bkgnd btn "lacto" to lacto
  464. set hilite of bkgnd btn "tried" to tried
  465. set hilite of bkgnd btn "ovo" to ovo
  466. set hilite of bkgnd btn "meattype" to meattype
  467. set hilite of bkgnd btn "fishtype" to fishtype
  468. end if
  469. end CopyCard
  470.  
  471.  
  472. on Browse
  473. if hilite of cd btn "Hide Search" of cd Browse then
  474. lock Screen
  475. end if
  476.  
  477. --start on correct card/skip last matching card
  478. if char 7 to 12 of name of this card is not "Recipe" then
  479. go card "Recipe1"
  480. else
  481. go next card
  482. end if
  483.  
  484. if not BrowseHunting() then
  485. answer "Match not found, enter new browsing parameters?" with "no", "yes"
  486. if it is "yes" then
  487. go card browse
  488. else
  489. go card index
  490. end if
  491. else if hilite of cd btn "sound" of cd Browse then play "Wild Eep"
  492. unlock Screen
  493. end Browse
  494.  
  495. --This function coordinates keywords searches and StepSearch
  496.  
  497. function BrowseHunting
  498. if hilite of cd button "Key Word" of cd Browse then
  499. put KeyWordMatches() into matchResults
  500. else
  501. put StepSearch() into matchResults
  502. end if
  503. return MatchResults
  504. end BrowseHunting
  505.  
  506.  
  507. -- This function checks to see if browse radio buttons match current card
  508. -- search criteria.
  509.  
  510. function OtherMatches
  511. put true into MatchResults
  512. if hilite of cd button "Lactose Free" of cd Browse and not hilite of bkgnd button "Lacto" then put false into matchResults
  513.  
  514. if hilite of cd button "ovo" of cd Browse and not hilite of bkgnd button "ovo" then put false into matchResults
  515. if hilite of cd button "Tried" of cd Browse and not hilite of bkgnd button "Tried" then put false into matchResults
  516.  
  517. if hilite of cd button "Meat" of cd Browse and not hilite of bkgnd button "MeatType" then put false into matchResults
  518.  
  519. if hilite of cd button "Fish" of cd Browse and not hilite of bkgnd button "FishType" then put false into matchResults
  520.  
  521. if hilite of cd button "Vegetarian" of cd Browse and not hilite of bkgnd button "VegetarianType" then put false into matchResults
  522.  
  523. put char 13 to 14 of name of this card into it
  524. if last char of it is quote then
  525. put first char of it into it
  526. end if
  527. if hilite of cd btn ("M"&((trunc of ((it-1)/7))+1)) of cd browse is not true then
  528. put false into MatchResults
  529. end if
  530. return MatchResults
  531. end OtherMatches
  532.  
  533.  
  534. --This function hunts for keywords (boolean) and makes sure the radio
  535. --buttons matchup.
  536.  
  537. function KeyWordMatches
  538. unmark all cards
  539. put number of this card into startingCard
  540. put true into looking
  541. put false into matchResults
  542. put "" into firstFound
  543.  
  544. repeat while looking
  545. set cursor to busy
  546. find string (cd fld "Key Word" of cd Browse)
  547.  
  548. if the result is not "not found" then
  549. put number of this card into currentCard
  550. if firstFound is "" then
  551. put id of this card into firstFound
  552. else if id of this cd = firstfound then
  553. put false into looking
  554. end if
  555.  
  556. if looking then
  557. mark this card
  558. if hilite of cd button "and" of cd Browse then
  559. find (cd fld "Key Word2" of cd Browse) of marked cards
  560. if the result is not "Not found" and OtherMatches() then
  561. put true into matchResults
  562. put false into looking
  563. end if
  564. else if hilite of cd button "not" of cd Browse then
  565. find (cd fld "Key Word2" of cd Browse) of marked cards
  566. if the result is "Not found" and OtherMatches() then
  567. put true into matchResults
  568. put false into looking
  569. end if
  570. else if OtherMatches() then
  571. put true into matchResults
  572. put false into looking
  573. end if --KW1 match,no not & and
  574. unmark this card
  575. end if --looking for --
  576. else put false into looking --since keyword not found no point in going on
  577.  
  578. if not matchResults and looking then --still hunting
  579. go next card
  580. end if
  581.  
  582. end repeat
  583. --'or' will overide an above negative search results
  584. if hilite of cd button "or" of cd Browse then
  585. go card startingCard
  586. find (cd fld "Key Word2" of cd Browse)
  587. if the result is not "Not found" and OtherMatches() then
  588. if not matchResults then
  589. put true into matchResults
  590. else
  591. if (the number of this card) > currentCard┬¼
  592. and (the number of this card) > startingCard then go card currentCard
  593. end if
  594. end if
  595.  
  596. end if
  597. return MatchResults
  598. end KeyWordMatches
  599.  
  600.  
  601. --this function steps through each recipe card and checks if its
  602. --characteristics match the radio buttons
  603.  
  604. function StepSearch
  605. put false into matchResults
  606. put false into done
  607. repeat until done
  608. set cursor to busy
  609. if OtherMatches() then
  610. put true into matchResults
  611. put true into done
  612. else
  613. if the id of this card is the id of last card then
  614. put true into done
  615. else
  616. go next card
  617. end if
  618. end if
  619. end repeat
  620. return matchResults
  621. end StepSearch
  622.  
  623. --this procedure removes all recipes from stack
  624. on MakeVirgin
  625. lock screen
  626. go line 1 of cd fld idsofRecipe of cd Conversion
  627. set userlevel to 5
  628. put false into done
  629. put the number of cards in this stack - the number of cd "Recipe1" into totalCards
  630. put 0 into zapped
  631. ProgressWindow "┬⌐Dome","Deleting","Now deleting all recipes"
  632. repeat while not done
  633. put 1 + zapped into zapped
  634. set "thePercent" of window "Deleting" to (zapped/totalCards * 100)
  635. if cantDelete of this card is true then
  636. doClearCard
  637. go next card
  638. if id of this card = id of first card then
  639. put true into done
  640. end if
  641. else
  642. domenu "Cut Card"
  643. if id of this card = id of first card then
  644. put true into done
  645. end if
  646. end if
  647. end repeat
  648.  
  649. set "theText" of window "Deleting" to "Now Updating Index"
  650. repeat with i = 1 to 7
  651. put empty into cd fld ("subAndRecipe"&i) of cd conversion
  652. repeat with j = 1 to 7
  653. put "blank,"&return after cd fld ("subAndRecipe"&i) of cd conversion
  654. end repeat
  655. end repeat
  656.  
  657. hide cd btn "Update Index" of Card "Index"
  658. go card index
  659. set visible of cd fld "indexList" to true
  660. set visible of cd button Parameters to true
  661. put "" into cd fld "indexList"
  662. show cd btn "Update Index"
  663. set userlevel to 2
  664. unlock screen
  665. close window "Deleting"
  666. domenu "Compact Stack"
  667. play boing "c5 b4 a"
  668. answer "Your stack is now devoid of recipes." with okay
  669. end MakeVirgin
  670.  
  671.  
  672. -- This procedure prints out the recipes listed on the index card.
  673.  
  674. on PrintIndex
  675. if cd fld "IndexList" is empty then
  676. answer "Index is empty, so no recipes will be printed."
  677. else
  678. if hilite of cd btn "Together" then
  679. unmark all cards
  680. repeat with i = 1 to number of lines in cd fld "IndexList"
  681. mark card id (last word of line i of cd fld Indexlist)
  682. end repeat
  683. open report printing
  684. print marked cards
  685. close printing
  686.  
  687. else
  688. repeat with i = 1 to number of lines in cd fld "IndexList"
  689. open report printing
  690. print card id (last word of line i of cd fld IndexList)
  691. close printing
  692. end repeat
  693. end if
  694. end if
  695. end PrintIndex
  696.  
  697. function BadCharReplace InputWord
  698. put empty into output
  699. repeat with i = 1 to number of chars in InputWord
  700. if char i of InputWord is in ";,^!<(/" & quote & return then
  701. put " " after output
  702. else
  703. put char i of InputWord after output
  704. end if
  705. end repeat
  706. return output
  707. end BadCharReplace
  708.  
  709. ---
  710. --****  PopUp Menu routines ****
  711. ---
  712.  
  713. on RecipeCardIndexBtn
  714.  
  715. put cd fld MainAndSub of cd conversion into choices
  716. put HPopUpMenu(choices, 0, top of bkgnd btn "i" +4, left of bkgnd btn "i" + 15) into place
  717. if place is empty then
  718. get the mouseLoc
  719. if it is within the rect of bkgnd btn "i" then
  720. set cursor to busy
  721. go to card id 4448
  722. end if
  723. else
  724. if item 3 of place > 0 then
  725. if item 3 of place is 1 then
  726. go cd item 2 of place
  727. exit RecipeCardIndexBtn
  728. end if
  729. put 7 * ((item 3 of place - 2)) + item 4 of place into CardNumber
  730. if item 4 of place = 0 then put 1 + CardNumber into CardNumber
  731. go line CardNumber of cd fld idsofRecipe of cd conversion
  732. end if
  733. end if
  734. end RecipeCardIndexBtn
  735.  
  736. on UpdateSubTabs TabName
  737. put bkgnd fld TabName into item (char 4 of TabName) +1 of line char 2 of TabName + 1 of cd fld MainAndSub of cd conversion
  738. end UpdateSubTabs
  739.  
  740. on SubTabPopMenu TabName
  741. if the optionKey is down then
  742. ask "New Tab Name"
  743. if the result is not "Cancel" then
  744. put BadCharReplace(it) into it
  745. if it is empty then put "blank" into it
  746. put it into bkgnd fld TabName
  747. UpdateSubTabs(TabName)
  748. end if
  749. else
  750. put char 2 of TabName into Main
  751. put char 4 of TabName into Sub
  752. put line sub of cd fld ("SubAndRecipe"& Main) of cd conversion into choices
  753. put HPopUpMenu(choices, -(the number of items in choices), top of bkgnd btn TabName -12, left of bkgnd btn TabName+4) into place
  754. if place is empty then
  755. get the mouseLoc
  756. if it is within the rect of bkgnd btn TabName then
  757. set cursor to busy
  758. visual effect scroll down fast
  759. go line (7 * (char 2 of TabName -1) + char 4 of TabName) of cd fld idsOfRecipe of cd conversion
  760. end if
  761. else
  762. if item 3 of place > 0 then
  763. go card (the number of (line 7*(Main - 1) + sub of cd fld IDsOfRecipe of cd conversion)┬¼
  764. + item 3 of place -1)
  765. end if
  766. end if
  767. end if
  768. end SubTabPopMenu
  769.  
  770. on MainTabPopMenu TabName
  771. if the optionKey is down then
  772. ask "New Tab Name"
  773. if the result is not "Cancel" then
  774. put BadCharReplace(it) into bkgnd field TabName
  775. UpdateMainTabs(TabName)
  776. end if
  777.  
  778. else
  779. put char 2 of tabName into Main
  780. put line Main +1 of cd fld MainAndSub of cd conversion into choices
  781. put "(" before first item of choices
  782. put HPopUpMenu(choices, sub, top of bkgnd btn TabName -5, left of bkgnd btn TabName) into place
  783. if place is empty then
  784. get the mouseLoc
  785. if it is within the rect of bkgnd btn TabName then
  786. set cursor to busy
  787. visual effect scroll down fast
  788. go card ("Recipe"&(7*(char 2 of TabName-1)+1))
  789. end if
  790. else
  791. if item 3 of place > 0 then
  792. go cd ("Recipe" & (7 * (main -1)) + item 3 of place -1)
  793. end if
  794. end if
  795. end if
  796.  
  797. end MainTabPopMenu
  798.  
  799. on UpdateMainTabs TabName
  800. put bkgnd fld TabName into item 1 of line char 2 of TabName +1 of cd fld MainAndSub of cd Conversion
  801. end UpdateMainTabs
  802.  
  803. on CardOpen TabName
  804. set the textstyle of bkgnd fld TabName to underline
  805. if bkgnd fld Recipe is empty then
  806. select after text of bkgnd fld Recipe
  807. end if
  808. end CardOpen
  809.  
  810. --Check to see if recipe name matches that found on the PopMenu list
  811. on CardClose TabName
  812. set the textstyle of bkgnd fld TabName to plain
  813. put bkgnd fld "Recipe" into CurrentRecipe
  814. if CurrentRecipe is not empty then
  815. put char 2 of TabName into Main
  816. put char 4 of TabName into Sub
  817. put the number of this card - the number of (line 7*(Main-1) + sub of cd fld IDsOfRecipe of cd conversion) into FromFirst
  818. put item FromFirst + 1 of line sub of cd fld ("SubAndRecipe"& Main) of cd conversion into InPopMenu
  819. if CurrentRecipe <> InPopMenu then
  820. put BadCharReplace(CurrentRecipe) into CurrentRecipe
  821. put CurrentRecipe into bkgnd fld "Recipe"
  822. put CurrentRecipe into item FromFirst + 1  of line sub of cd fld ("SubAndRecipe"& Main) of cd conversion
  823. end if
  824. end if
  825. end CardClose
  826.  
  827. --Called when a recipe is deleted
  828. --this routine deletes the recipe name being removed
  829. on RemoveNameFromMenu
  830. put the short name of this card into cardName
  831. put the number of this card into skipCard
  832. if the length of cardName < 8 then
  833. put char 7 of cardName into BaseNumber
  834. else
  835. put char 7 to 8 of cardName into BaseNumber
  836. end if
  837. put (BaseNumber-1) div 7 into Main
  838. put BaseNumber mod 7 into sub
  839. if sub = 0 then put 7 into sub
  840. put 1 + skipCard -the number of (line BaseNumber of cd fld IDsOfRecipe of cd conversion) into skipItem
  841. put empty into temp
  842. put line sub of cd fld ("SubAndRecipe"&Main+1) of cd conversion into workingMenu
  843. if skipItem>1 then put item 1 to skipItem-1 of WorkingMenu  & "," into temp
  844. else if cantdelete of this card is not false then put "blank," into temp
  845. if skipItem < the number of items in workingMenu then put item skipItem+1 to (the number of items of workingMenu) of workingMenu & "," after temp
  846. put temp into line sub of cd fld ("SubAndRecipe"&Main+1) of cd conversion
  847. end RemoveNameFromMenu
  848.  
  849.  
  850. --Inserts blank into popMenu for new cards
  851. on NewRecipeInMenu
  852. put the short name of this card into cardName
  853. if length of cardName < 8 then
  854. put char 7 of cardName into BaseNumber
  855. else
  856. put char 7 to 8 of cardName into BaseNumber
  857. end if
  858. put (BaseNumber-1) div 7 into Main
  859. put BaseNumber mod 7 into sub
  860. if sub = 0 then put 7 into sub
  861. put the number of (line BaseNumber of cd fld IDsOfRecipe of cd conversion) into starting
  862. put the number of this card - starting into displace
  863. put ",blank" after item displace of line sub of cd fld ("SubAndRecipe"&Main+1) of cd conversion
  864. end NewRecipeInMenu
  865.  
  866. on UpdateAllSubTabs
  867. put empty into cd fld IDsOfRecipe of cd conversion
  868. repeat with j = 1 to 7
  869. put empty into cd fld ("SubAndRecipe" & j) of cd conversion
  870. set cursor to busy
  871. repeat with i = 1 to 7
  872. set cursor to busy
  873. put empty into temp
  874. put the number of cd ("Recipe" & 7*(j-1) + i) into starting
  875. put ("Recipe" & 7*(j-1) + i+1) into temp3
  876.  
  877. if there is no card temp3 then
  878. put the number of the last card into ending
  879. else
  880. put (the number of cd temp3) - 1 into ending
  881. end if
  882. put (the id of cd starting) & return after cd fld IDsOfRecipe of cd conversion --keep track of place holder ids.
  883. repeat with k = starting to ending
  884. put bkgnd fld "Recipe" of cd k into temp2
  885. if temp2 is empty then put "blank" into temp2
  886. else put BadCharReplace(temp2) into temp2
  887. put temp2 &"," after temp
  888. end repeat
  889. put temp & return after cd fld ("SubAndRecipe" & j) of cd conversion
  890. end repeat
  891. end repeat
  892. end UpdateAllSubTabs
  893.  
  894. on MoveCard
  895. if bkgnd fld recipe is empty then
  896. answer "Give this recipe a title before moving." with okay
  897. else
  898. put the long id of this card into cd fld moving of cd conversion
  899. lock screen
  900. go card "Index"
  901. show cd fld Background
  902. show cd button "Cancel"
  903. show cd btn "Click and Hold"
  904. show cd fld "movingMask"
  905. unlock screen
  906. end if
  907. end MoveCard
  908. </script>
  909.     <background id="3625" file="background_3625.xml" name="Art" />
  910.     <background id="6329" file="background_6329.xml" name="M3" />
  911.     <background id="7902" file="background_7902.xml" name="M1" />
  912.     <background id="10944" file="background_10944.xml" name="M4" />
  913.     <background id="15254" file="background_15254.xml" name="" />
  914.     <background id="15939" file="background_15939.xml" name="M5" />
  915.     <background id="20789" file="background_20789.xml" name="M6" />
  916.     <background id="23248" file="background_23248.xml" name="M2" />
  917.     <background id="26175" file="background_26175.xml" name="M7" />
  918.     <card id="4448" file="card_4448.xml" marked="false" name="Index" owner="3625" />
  919.     <card id="7555" file="card_7555.xml" marked="false" name="Browse" owner="3625" />
  920.     <card id="15091" file="card_15091.xml" marked="false" name="Conversion" owner="15254" />
  921.     <card id="7203" file="card_7203.xml" marked="false" name="Recipe1" owner="7902" />
  922.     <card id="9437" file="card_9437.xml" marked="false" name="Recipe2" owner="7902" />
  923.     <card id="17655" file="card_17655.xml" marked="false" name="Recipe3" owner="7902" />
  924.     <card id="23487" file="card_23487.xml" marked="false" name="Recipe4" owner="7902" />
  925.     <card id="35989" file="card_35989.xml" marked="false" name="Recipe5" owner="7902" />
  926.     <card id="36243" file="card_36243.xml" marked="false" name="Recipe6" owner="7902" />
  927.     <card id="36476" file="card_36476.xml" marked="false" name="Recipe7" owner="7902" />
  928.     <card id="36803" file="card_36803.xml" marked="false" name="Recipe8" owner="23248" />
  929.     <card id="37082" file="card_37082.xml" marked="false" name="Recipe9" owner="23248" />
  930.     <card id="8723" file="card_8723.xml" marked="false" name="Recipe10" owner="23248" />
  931.     <card id="23943" file="card_23943.xml" marked="false" name="Recipe11" owner="23248" />
  932.     <card id="24330" file="card_24330.xml" marked="false" name="Recipe12" owner="23248" />
  933.     <card id="25079" file="card_25079.xml" marked="false" name="Recipe13" owner="23248" />
  934.     <card id="6022" file="card_6022.xml" marked="false" name="Recipe14" owner="23248" />
  935.     <card id="7943" file="card_7943.xml" marked="false" name="Recipe15" owner="6329" />
  936.     <card id="8535" file="card_8535.xml" marked="false" name="Recipe16" owner="6329" />
  937.     <card id="5349" file="card_5349.xml" marked="false" name="Recipe17" owner="6329" />
  938.     <card id="10356" file="card_10356.xml" marked="false" name="Recipe18" owner="6329" />
  939.     <card id="10542" file="card_10542.xml" marked="false" name="Recipe19" owner="6329" />
  940.     <card id="9607" file="card_9607.xml" marked="false" name="Recipe20" owner="6329" />
  941.     <card id="10163" file="card_10163.xml" marked="false" name="Recipe21" owner="6329" />
  942.     <card id="11756" file="card_11756.xml" marked="false" name="Recipe22" owner="10944" />
  943.     <card id="12871" file="card_12871.xml" marked="false" name="Recipe23" owner="10944" />
  944.     <card id="13153" file="card_13153.xml" marked="false" name="Recipe24" owner="10944" />
  945.     <card id="13334" file="card_13334.xml" marked="false" name="Recipe25" owner="10944" />
  946.     <card id="13655" file="card_13655.xml" marked="false" name="Recipe26" owner="10944" />
  947.     <card id="14181" file="card_14181.xml" marked="false" name="Recipe27" owner="10944" />
  948.     <card id="15509" file="card_15509.xml" marked="false" name="Recipe28" owner="10944" />
  949.     <card id="15675" file="card_15675.xml" marked="false" name="Recipe29" owner="15939" />
  950.     <card id="17896" file="card_17896.xml" marked="false" name="Recipe30" owner="15939" />
  951.     <card id="18014" file="card_18014.xml" marked="false" name="Recipe31" owner="15939" />
  952.     <card id="18393" file="card_18393.xml" marked="false" name="Recipe32" owner="15939" />
  953.     <card id="19596" file="card_19596.xml" marked="false" name="Recipe33" owner="15939" />
  954.     <card id="19936" file="card_19936.xml" marked="false" name="Recipe34" owner="15939" />
  955.     <card id="20248" file="card_20248.xml" marked="false" name="Recipe35" owner="15939" />
  956.     <card id="20719" file="card_20719.xml" marked="false" name="Recipe36" owner="20789" />
  957.     <card id="21961" file="card_21961.xml" marked="false" name="Recipe37" owner="20789" />
  958.     <card id="22452" file="card_22452.xml" marked="false" name="Recipe38" owner="20789" />
  959.     <card id="22957" file="card_22957.xml" marked="false" name="Recipe39" owner="20789" />
  960.     <card id="25829" file="card_25829.xml" marked="false" name="Recipe40" owner="20789" />
  961.     <card id="2192" file="card_2192.xml" marked="false" name="Recipe41" owner="20789" />
  962.     <card id="2724" file="card_2724.xml" marked="false" name="Recipe42" owner="20789" />
  963.     <card id="25959" file="card_25959.xml" marked="false" name="Recipe43" owner="26175" />
  964.     <card id="28156" file="card_28156.xml" marked="false" name="Recipe44" owner="26175" />
  965.     <card id="34006" file="card_34006.xml" marked="false" name="Recipe45" owner="26175" />
  966.     <card id="34965" file="card_34965.xml" marked="false" name="Recipe46" owner="26175" />
  967.     <card id="35306" file="card_35306.xml" marked="false" name="Recipe47" owner="26175" />
  968.     <card id="9810" file="card_9810.xml" marked="false" name="Recipe48" owner="26175" />
  969.     <card id="7004" file="card_7004.xml" marked="false" name="Recipe49" owner="26175" />
  970. </stack>
  971.